#include<bits/stdc++.h>
using namespace std;
namespace IO{
    const int BUF=1<<21;
    char buff[BUF],*p1=buff,*p2=buff;
    #define gc() (p1==p2&&(p2=((p1=buff)+fread(buff,1,BUF,stdin)),p1==p2)?EOF:*p1++)
    template<typename T>inline void read(T &x){
        char ch=gc();x=0;int f=1;
        while(!isdigit(ch)){if(ch=='-')f=-1;ch=gc();}
        while(isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=gc();
        x*=f;
    }
    char obuf[BUF],*p3=obuf;
    inline void pc(char ch){
        if(p3-obuf<BUF) *p3++=ch;
        else fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=ch;
    }
    inline void put(const char *s){while(*s) pc(*s),++s;}
    char ch[32],ctop;
    template<typename T>inline void print(T x){
    	if(x<0) x=~x+1,pc('-');
        if(!x) return pc(48);
        while(x) ch[++ctop]=x%10^48,x/=10;
        while(ctop) pc(ch[ctop--]);
    }
    inline void flush(){fwrite(obuf,p3-obuf,1,stdout);p3=obuf;}
}
using namespace IO;

int S,Q;
bool f[76][76][76][76][2],vis[76][76][76][76][2];
bool F(int n1,int h1,int n2,int h2,bool p){
	if(vis[n1][h1][n2][h2][p]) return f[n1][h1][n2][h2][p];
	if(!h1) return 1;
	if(!h2) return 0;
	vis[n1][h1][n2][h2][p]=1;
	if(!p){
		if(n2&&!F(n1,h1,n2-1,h2,1)) return f[n1][h1][n2][h2][p]=0;
		if(max(0,h1-S*n2)>=h2||!F(n1,h1,n2,h2-max(0,h1-S*n2),1)) return f[n1][h1][n2][h2][p]=0;
		return f[n1][h1][n2][h2][p]=1;
	}else{
		if(n1&&F(n1-1,h1,n2,h2,0)) return f[n1][h1][n2][h2][p]=1;
		if(max(0,h2-S*n1)>=h1||F(n1,h1-max(0,h2-S*n1),n2,h2,0)) return f[n1][h1][n2][h2][p]=1;
		return f[n1][h1][n2][h2][p]=0;
	}
}
int main(){
	freopen("game.in","r",stdin);
	freopen("game.out","w",stdout);
	read(S),read(Q);
	while(Q--){
		int h1,n1,h2,n2;
		read(h1),read(n1),read(h2),read(n2);
		put(F(n1,h1,n2,h2,0)?"NO\n":"YES\n");
	}
	flush();
	return 0;
}


